package com.itita.ww2.data;

import com.smartfoxserver.v2.entities.data.ISFSObject;

public class GameConfig {
	public static boolean isLoaded = false;
	/*
	 * 各项配置数据缓存
	 */
	private static ISFSObject gameCfg; // 游戏配置
	private static ISFSObject rankCfg; // pvp排行配置
	// 
	private static ISFSObject scienceCfg; // 科技配置
	// 

	/*
	 * Functions
	 */
	public static void init(ISFSObject data) {
		GameConfig.gameCfg = data.getSFSObject("game");
		GameConfig.rankCfg = data.getSFSObject("rank");
		//
		GameConfig.scienceCfg = data.getSFSObject("science");
		// 
		GameConfig.isLoaded = true;
	}

	/**
	 * 获取算法中的ratio值
	 */
	public static final float getDataParams(String key) {
		return gameCfg.getSFSObject("DataParams").getFloat(key);
	}

	public static final float getTimeGoldRatioArmy() {
		return gameCfg.getSFSObject("TimeGoldRatio").getFloat("army");
	}

	public static final float getTimeGoldRatioBD() {
		return gameCfg.getSFSObject("TimeGoldRatio").getFloat("building");
	}

	public static final ISFSObject getGameCfg() {
		return gameCfg;
	}

	public static final ISFSObject getRankCfg() {
		return rankCfg;
	}

	public static final ISFSObject getScienceCfg() {
		return scienceCfg;
	}
}
